<%-- 
    Document   : print_order
    Created on : Jan 30, 2013, 2:26:15 PM
    Author     : KAKAIT
--%>
<%@page import="model.entity.Product"%>
<%@page import="model.entity.BillDetail"%>
<%@page import="java.util.List"%>
<%@page import="model.BillImp"%>
<%@page import="model.ProductImp"%>
<%@page import="model.entity.Account"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Print Order # 100000004</title>
<meta name="description" content="Default Description">
<meta name="keywords" content="Magento, Varien, E-commerce">
<meta name="robots" content="INDEX,FOLLOW">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" href="#" type="image/x-icon">
<link rel="shortcut icon" href="#" type="image/x-icon">
    <link rel="stylesheet" type="text/css" href="css/font.css" media="all">
<link rel="stylesheet" type="text/css" href="css/styles-ie.css" media="all">
<link rel="stylesheet" type="text/css" href="css/styles.css" media="all">
<link rel="stylesheet" type="text/css" href="css/widgets.css" media="all">
<link rel="stylesheet" type="text/css" href="css/style_002.css" media="all">
<link rel="stylesheet" type="text/css" href="css/style_004.css" media="all">
<link rel="stylesheet" type="text/css" href="css/style_003.css" media="all">
    <link rel="stylesheet" type="text/css" href="css/style_005.css" media="all">
<link rel="stylesheet" type="text/css" href="css/style_006.css" media="all">
<link rel="stylesheet" type="text/css" href="css/style_007.css" media="all">
<link rel="stylesheet" type="text/css" href="css/style.css" media="all">
<link rel="stylesheet" type="text/css" href="css/print.css" media="print">
<link rel="stylesheet" type="text/css" href="css/extensions.css" media="all">
<link rel="stylesheet" type="text/css" href="css/easytabs.css" media="all">
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css" media="all">
<link rel="stylesheet" type="text/css" href="css/jquery.css" media="all">
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/translate.js"></script>
<script type="text/javascript" src="js/ccard.js"></script>
<script type="text/javascript" src="js/validation.js"></script>
<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="js/weee.js"></script>
<script type="text/javascript" src="js/script_002.js"></script>
<script type="text/javascript" src="js/script_003.js"></script>
<script type="text/javascript" src="js/ddsmoothmenu.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="http://www.venustheme.com/demo/ves_megastore/skin/frontend/default/default/css/styles-ie.css" media="all" />
<![endif]-->
<!--[if lt IE 7]>
<script type="text/javascript" src="http://www.venustheme.com/demo/ves_megastore/js/lib/ds-sleight.js"></script>
<script type="text/javascript" src="http://www.venustheme.com/demo/ves_megastore/skin/frontend/base/default/js/ie6.js"></script>
<![endif]-->
<script type="text/javascript">//<![CDATA[
        var Translator = new Translate([]);
        //]]></script>
</head>
<body class="page-print sales-order-print">
    <%
        String datepurchase = request.getParameter("datepurchase");
        SimpleDateFormat formater = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
        Date date = formater.parse(datepurchase);
        DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.MEDIUM);  
        String billid = request.getParameter("billid");
        Account ac = (Account)session.getAttribute("acc");
        ProductImp pi = new ProductImp();
        BillImp bi = new BillImp();
        List<BillDetail> bdt = bi.ListBillDetail(billid);
    %>
<div>
    <div class="print-head">
        <img src="<c:url value="<%= "/images/logo.jpg" %>" />" class="logo">
    </div>
    <h1>Order #<%= billid %></h1>
<p class="order-date">Order Date: <%= df.format(date.getTime()) %></p>
<div class="col2-set order-info-box">
    <div class="col-1">
        <div class="box">
            <div class="box-title">
                <h2>Billing Address</h2>
            </div>
            <div class="box-content">
                <address><%= ac.getFirstname() +" "+ ac.getLastname() %><br>
                    <%= ac.getStreet() %><br>
                    <%= ac.getCity() %> <%= ac.getState_province().toString()!= null ? ac.getState_province() : "" %><br>
                    <%= ac.getCountry() %>.<br>
                    T: <%= ac.getMobile() %><br>
                </address>
            </div>
        </div>
    </div>
    <div class="col-2">
        <div class="box box-payment">
            <div class="box-title">
                <h2>Payment Method</h2>
            </div>
            <div class="box-content">
                <p>Check / Money order</p>
            </div>
        </div>
    </div>
    <div class="col-2">
        <div class="box">
            <div class="box-title">
                <h2>Shipping Method</h2>
            </div>
            <div class="box-content">
                Flat Rate - Fixed 
            </div>
        </div>
    </div>
</div>
<h2>Items Ordered</h2>
    <table summary="Items Ordered" id="my-orders-table" class="data-table">
        <colgroup>
            <col width="1">
            <col>
            <col width="1">
            <col width="1">
            <col width="1">
        </colgroup>
        <thead>
            <tr class="first last">
                <th>Product Image</th>
                <th>Product Name</th>
                <th class="a-right">Price</th>
                <th class="a-center">Qty</th>
                <th class="a-right">Subtotal</th>
            </tr>
        </thead>
        
        <tbody class="odd">
            <% 
                double grand_Total = 0;
                for(int i = 0;i < bdt.size();i++)
                {
                    Product pro = pi.DetailProduct(bdt.get(i).getProductid());
                    double money = pro.getTotalamount() * bdt.get(i).getQuantity();
                    grand_Total += money;
            %>
            
            <tr id="order-item-row-2" class="border first last">
                <td><a class="product-image" title="<%= pro.getProductname() %>" href="#"><img width="150" height="150" alt="" src="<c:url value="<%= "/images/product/"+pro.getPicture() %>" />"></a></td>
                <td><h3 class="product-name"><%= pro.getProductname() %></h3></td>
                <td class="a-right">
                                    <span class="cart-price"><span class="price">$<%= Double.toString(pro.getTotalamount()) %></span></span>
                            </td>
                <td class="a-center sct-quantity">
                                <span class="cart-price"><span class="price"><%= bdt.get(i).getQuantity() %></span></span>
                                
                </td>
                <td class="a-right sct-price">
                                <span class="cart-price"><span class="price">$<%= Double.toString(money) %></span></span>
                </td>
    <!--
        <th class="a-right"><span class="price">$999.00</span></th>
            -->
            </tr>
            
            <%}%>
        </tbody>
        <tfoot>
            <tr class="subtotal first">
            <td class="a-righttfoot" colspan="4">
                            Subtotal                    </td>
            <td class="last a-righttfoot">
                            <span class="price">$<%= grand_Total %></span>                    </td>
            </tr>
            <tr class="shipping">
            <td class="a-righttfoot" colspan="4">
                            Shipping &amp; Handling                    </td>
            <td class="last a-righttfoot">
                <%
                                        double d = 0;
                                           if(bdt.size()<4)
                                               d = 10;
                                           else if(bdt.size()>=4 && bdt.size()<8)
                                               d = 20;
                                           else if(bdt.size()>=8)    
                                               d = 50;
                                              
                %>
                <span class="price">$<%= d %></span>                    
            </td>
            </tr>
            <tr class="grand_total last">
            <td class="a-righttfoot" colspan="4">
                            <strong>Grand Total</strong>
                        </td>
            <td class="last a-righttfoot">
                            <strong><span class="price">$<%= grand_Total + d %></span></strong>
                        </td>
            </tr>
        </tfoot>
    </table>

<script type="text/javascript">decorateTable('my-orders-table', {'tbody' : ['odd', 'even'], 'tbody tr' : ['first', 'last']})</script>
<script type="text/javascript">window.print();</script>
    <div class="buttons-set">
        <button type="button" title="Close Window" class="button" onclick="window.close();"><span><span>Close Window</span></span></button>
    </div>
    </div>


</body></html>
